﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Collections;
using DAO;
using DTO;

namespace BUS
{
    public class CLOAIKHACHTHUEBUS
    {
        public static CLOAIKHACHTHUEDTO LayThongTinLoaiKhachThue(int MaLoaiKhachThue)
        {
            CLOAIKHACHTHUEDTO loaikhachthueDto = new CLOAIKHACHTHUEDTO();
            loaikhachthueDto = CLOAIKHACHTHUEDAO.LayThongTinLoaiKhachThue(MaLoaiKhachThue);
            return loaikhachthueDto;
        }
        public static List<CLOAIKHACHTHUEDTO> LayDanhSachLoaiKhachThue()
        {
            List<CLOAIKHACHTHUEDTO> ds = new List<CLOAIKHACHTHUEDTO>();
            ds = CLOAIKHACHTHUEDAO.LayDanhSachLoaiKhachThue();
            return ds;
        }
        public static List<CLOAIKHACHTHUEDTO> LayDanhSachLoaiKhachThueDaDanhDauXoa()
        {
            List<CLOAIKHACHTHUEDTO> ds = new List<CLOAIKHACHTHUEDTO>();
            ds = CLOAIKHACHTHUEDAO.LayDanhSachLoaiKhachThueDaDanhDauXoa();
            return ds;
        }
        public static List<CLOAIKHACHTHUEDTO> LayDanhSachLoaiKhachThueChuaDanhDauXoa()
        {
            List<CLOAIKHACHTHUEDTO> ds = new List<CLOAIKHACHTHUEDTO>();
            ds = CLOAIKHACHTHUEDAO.LayDanhSachLoaiKhachThueChuaDanhDauXoa();
            return ds;
        }
        public static DataTable LayBang()
        {
            DataTable dt;
            dt = CLOAIKHACHTHUEDAO.LayBang();
            return dt;
        }
        public static DataTable LayBangLoaiKhachThue()
        {
            DataTable dt;
            dt = CLOAIKHACHTHUEDAO.LayBangLoaiKhachThue();
            return dt;
        }
        public static DataTable LayBangLoaiKhachThueDaDanhDauXoa()
        {
            DataTable dt;
            dt = CLOAIKHACHTHUEDAO.LayBangLoaiKhachThueDaDanhDauXoa();
            return dt;
        }
        public static DataTable LayBangLoaiKhachThueChuaDanhDauXoa()
        {
            DataTable dt;
            dt = CLOAIKHACHTHUEDAO.LayBangLoaiKhachThueChuaDanhDauXoa();
            return dt;
        }
        public static void ThemLoaiKhachThue(CLOAIKHACHTHUEDTO loaikhachthueDto)
        {
            CLOAIKHACHTHUEDAO loainguoidungDao = new CLOAIKHACHTHUEDAO();
            loainguoidungDao.ThemLoaiKhachThue(loaikhachthueDto);
        }
        public static void CapNhatTinhTrangLoaiKhachThue(int MaLoaiKhachThue, bool TinhTrang)
        {
            CLOAIKHACHTHUEDAO.CapNhatTinhTrangLoaiKhachThue(MaLoaiKhachThue, TinhTrang);
        }
        public static void XoaLoaiKhachThue(int MaLoaiKhachThue)
        {
            CLOAIKHACHTHUEDAO.XoaLoaiKhachThue(MaLoaiKhachThue);
        }
        public static void CapNhatThongTinLoaiKhachThue(CLOAIKHACHTHUEDTO loaikhachthueDto)
        {
            CLOAIKHACHTHUEDAO loaikhachthueDao = new CLOAIKHACHTHUEDAO();
            loaikhachthueDao.CapNhatThongTinLoaiKhachThue(loaikhachthueDto);
        }
        public static void ThayDoiHeSoLoaiKhachThue(int MaLoaiKhachThue, double HeSoLoaiKhach)
        {
            CLOAIKHACHTHUEDAO.ThayDoiHeSoLoaiKhachThue(MaLoaiKhachThue, HeSoLoaiKhach);
        }

    //    //bổ sung
        public static List<CLOAIKHACHTHUEDTO> LayDanhSachLoaiKhachThueDaDuyet()
        {
            List<CLOAIKHACHTHUEDTO> ds = new List<CLOAIKHACHTHUEDTO>();
            ds = CLOAIKHACHTHUEDAO.LayDanhSachLoaiKhachThueDaDuyet();
            return ds;
        }





        //Nguyên
        //kiểm tra chuổi toàn là số
        public static bool kiemTraChuoiLaSo(string chuoi)
        {
            foreach (char i in chuoi)
                if (char.IsDigit(i) == false)
                    return false;
            return true;
        }
         
        //kiểm tra tên loại khách là duy nhất
        public static bool kiemTraTenLoaiKhachDuyNhat(string tenLoaiKhach)
        {
            List<CLOAIKHACHTHUEDTO> dsloaiKhachThue = new List<CLOAIKHACHTHUEDTO>();
            dsloaiKhachThue = CLOAIKHACHTHUEDAO.LayDanhSachLoaiKhachThueChuaDanhDauXoa();
            foreach (CLOAIKHACHTHUEDTO i in dsloaiKhachThue)
                if (i.TenLoaiKhachThue == tenLoaiKhach)
                    return false;
            return true;
        }
        //them he so loai khach thue day du
        public static void ThemLoaiKhachThue1(CLOAIKHACHTHUEDTO loaikhachthueDto)
        {
            CLOAIKHACHTHUEDAO loainguoidungDao = new CLOAIKHACHTHUEDAO();
            loainguoidungDao.ThemLoaiKhachThue1(loaikhachthueDto);
        }
        
        public static void ThayDoiHeSoMoiLoaiKhachThue(CLOAIKHACHTHUEDTO loaiKhachThue)
        {
            CLOAIKHACHTHUEDAO.ThayDoiHeSoMoiLoaiKhachThue(loaiKhachThue);
        }
        ///Ấn
        public static DataTable LayBangLoaiKhachThueChuaDuyet()
        {
            DataTable dt;
            dt = CLOAIKHACHTHUEDAO.LayBangLoaiKhachThueChuaDuyet();
            return dt;
        }


        public static void DuyetHeSoLoaiKhach(int maLoaiKhach)
        {
            CLOAIKHACHTHUEDAO.DuyetHeSoLoaiKhach(maLoaiKhach);
        }
            
        public static DataTable LayBangLoaiKhachThueDaDuyet()
        {
            DataTable dt = CLOAIKHACHTHUEDAO.LayBangLoaiKhachThueDaDuyet();
            return dt;
        }
    }
    
}
